<template>
    <div class="city-letter">
        <p class="title">{{ ky }}</p>
        <div class="list">
            <span v-for="item in dt" @click="handleClick(item)">{{ item.name }}</span>
        </div>
    </div>
</template>

<script>
    export default {
        name: "CityModule",
        props: ['dt','ky'],
        methods: {
            handleClick(obj) {
                //调用vuex提交mutation
                this.$store.commit('setCity',obj)
                // 跳回到首页
                this.$router.push('/')
            }
        }
    }
</script>

<style scoped>
    .title {
        background: #eeeeee;
        height: 30px;
        line-height: 30px;
        padding: 0 10px;
        font-size: 14px;
    }
    .list {
        display: flex;
        flex-wrap: wrap;
    }
    span {
        width: calc(100% / 4);
        height: 30px;
        line-height: 30px;
        box-sizing: border-box;
        text-align: center;
        font-size: 15px;
    }

</style>